package model

import (
	"gorm.io/gorm"
	"time"
)

type Video struct {
	Id        uint32         `gorm:"column:id;type:int UNSIGNED;comment:视频id;primaryKey;not null;"  form:"id" json:"id"` // 视频id
	Title     string         `gorm:"column:title;type:varchar(255);comment:视频标题;not null;"  form:"title" json:"title"`   // 视频标题
	Image     string         `gorm:"column:image;type:varchar(255);comment:视频封面;not null;"  form:"image" json:"image"`   // 视频封面
	Auth      string         `gorm:"column:auth;type:varchar(255);comment:作者;not null;"  form:"auth" json:"auth"`        // 作者
	Info      string         `gorm:"column:info;type:varchar(255);comment:简介内容;not null;"  form:"info" json:"info"`      // 简介内容
	Url       string         `gorm:"column:url;type:varchar(255);comment:视频地址;not null;"  form:"url" json:"url"`         // 视频地址
	UserId    int32          `gorm:"column:user_Id;type:int;comment:发布人ID;not null;"  form:"user_Id" json:"user_Id"`     // 发布人ID
	Views     string         `gorm:"column:views;type:varchar(3);not null;"  form:"views" json:"views"`
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);"  form:"created_at" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);"  form:"updated_at" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;"  form:"deleted_at" json:"deleted_at"`
}

func (v Video) TableName() string {
	return "video"
}
